#!/usr/bin/python3

shabi = ['小红', '小绿', '小楠', '小甜', '小辣', '小小']
for i in shabi:
    print(i)

shabi = ['小红', '小绿', '小楠', '小甜', '小辣', '小小']
print('小小索引值为', shabi.index('小小'))
print(shabi)
print(shabi[-2])
print(shabi[-3])
# enumerate 迭代函数可以生成一个下标和一个元素
my_list = [1, 2, 3, 4, 5]
for num in enumerate(my_list):
    print(num)

# 使用for循环遍历列表
names = ["Jack", "Lucy", "Lily", "Tom", "IronMan"]

# !/usr/bin/python3

# 可写函数说明
def changeme(mylist):
    "修改传入的列表"
    mylist.append([1, 2, 3, 4])
    print("函数内取值: ", mylist)
    return

# 调用changeme函数
mylist = [10, 20, 30]
changeme(mylist)
print("函数外取值: ", mylist)
i = sum = 0

while i <= 3:
    sum += i
    i = i+1

print(sum)
from  random import sample
print(sample(range(1,100),20))
import random
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
result = random.sample(my_list, 3)
print(result)
# i = eval(input("请输入一个数字"))
# x = eval(input("请输入一个数字"))
# z = i + x
# print(i + x)
# 找出分数大于90分的同学并打印出题目的名字
students = [{'name': 'run3oob', 'score': 91},
            {'name': 'run4oob', 'score': 60},
            {'name': 'runoooob', 'score': 70},
            {'name': 'roob', 'score': 95}]


# 1. 从60行到69行，一共有几个变量
# 2. 这些变量的作用域是从第几行到第几行，在哪个位置可以使用这个变量
# name：67-75
# sts：68-75
# over90_scores_list：69-75
# score_standard：70-75
# i：71-74
# age：72-74
# size：74
name = []
def over_90score(sts):
    over90_scores_list = []
    score_standard = 90
    for i in sts:
        age = 30
        if i['score'] > score_standard:
            size = 80
            over90_scores_list.append(i['name'])
    return over90_scores_list






result = over_90score(students)
print(result)
# scores_list = []
#
# for i in students:
#     # print(i['score'])
#     scores_list.append(i['score'])
# print(scores_list)







